home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9719 < prev    next >
Encoding:
Text File  |  1996-08-05  |  3.0 KB  |  68 lines

  1. Path: news.belwue.de!uzwil!kuehl
  2. From: kuehl@uzwil.informatik.uni-konstanz.de (Dietmar Kuehl)
  3. Newsgroups: comp.lang.c++,gnu.g++.help
  4. Subject: Re: DONT UNDERSTAND - array of char error
  5. Followup-To: comp.lang.c++,gnu.g++.help
  6. Date: 4 Mar 1996 02:31:55 GMT
  7. Organization: FakultΣt fⁿr Mathematik und Informatik
  8. Message-ID: <4hdkmr$j1d@news.BelWue.DE>
  9. References: <4habvu$99j@panix.com> <4hahju$bil@news.BelWue.DE> <4hcbje$h52@panix.com>
  10. Reply-To: dietmar.kuehl@uni-konstanz.de
  11. NNTP-Posting-Host: uzwil.informatik.uni-konstanz.de
  12. X-Newsreader: TIN [version 1.2 PL2]
  13.  
  14. Hi,
  15. Arthur Cinader Jr (acinader@panix.com) wrote:
  16. : Wow, thanks.  I love the internet and thank you for your kind
  17. : assistance!
  18.  
  19. Well, this type of answer you will get for nearly every (real) C++
  20. question posted in comp.lang.c++.moderated (not necessarily by myself,
  21. of course...). It takes somewhat longer (because of the moderation) but
  22. we (i.e. the moderators of clc++m) hurry to make the delay small. Just
  23. have a look at this newsgroup! It is intended for all questions of
  24. (nearly) all levels of experience: only stuff found in the first few
  25. chapters of a C++ tutorial and stuff answered in the FAQ file is
  26. rejected. Just some advertising :-)
  27.  
  28. : >... i.e. 'fieldlength' has to be a 'const'. If 'fieldlength' is
  29. : >non-const you have to allocate the second dimension by hand (unless you
  30. : >use an array class like suggested below):
  31.  
  32. : I thought I covered this by making 
  33.  
  34. :     const int fieldlength;
  35.  
  36. : and using a member intializer like this:
  37.  
  38. :     Param::Param(char *shape)
  39. :         :maxargs(10), fieldlength(20)
  40.  
  41. No, this is not sufficient (my statement above is indeed misleading):
  42. Actually, the array dimensions have to be "constant expression", i.e.
  43. expression, that can be evaluated at compile-time. Just feeding in some
  44. 'const int' is not sufficient.
  45.  
  46. : Your point noted, but I am going to risk it in this case.  I
  47. : am overwhelmed enough without having to stop now to figure out
  48. : how to use the libraries and understand their interface.  I do
  49. : recognize this as a crucial part of my becoming productive and
  50. : I will endevour to find documentation on the ISO standard
  51. : library and learn about how to use it.  FWIW the next chapter
  52. : in the text is on I/O streams which I believe spends a
  53. : considerable amount of time explaining "pre-packaged" class
  54. : hiararchies and how to navigate them.
  55.  
  56. I would love if there were a C++ tutorial which introduces C++ hand in
  57. hand with the ISO Standard C++ Library. Unfortunately, I didn't came
  58. across such a tutorial yet :-( However, if you have managed to get
  59. enough insights into C++ to be ready for a library, I suggest you learn
  60. about STL the Standard Template Library (which is just a name devoted
  61. to a certain subset of the C++ Library). There is a good tutorial on
  62. this topic available: "STL Tutorial and Reference Guide", D.Musser &
  63. A.Saini, Addison-Wesley.
  64. --
  65. dietmar.kuehl@uni-konstanz.de
  66. http://www.informatik.uni-konstanz.de/~kuehl
  67. I am a realistic optimist - that's why I appear to be slightly pessimistic
  68.